#-*- coding:UTF-8 -*-

import os
import sys

def getFolderName(folderPath):
    index = folderPath.rfind('\\')
    folderName = folderPath[index+1 :]
    return folderName

if __name__ == '__main__':
    if (len(sys.argv) < 2):
        exit(0)
    folderPath = sys.argv[1]
    imgNames = os.listdir(folderPath)
    if (len(imgNames) == 0):
        print 'there are not image in the folder'
        exit(0)
    folderName = getFolderName(folderPath)
    textFile = open(folderName + '.txt', 'w')
    for name in imgNames:
        path = folderPath + '\\' + name + '\n'
        textFile.writelines(path)
    textFile.close()
    
    
